package com.linkgie.galaxyframework.utils;

import java.util.function.Predicate;

public class Predicates {

	private static final AlwaysTruePredicate ALWAYS_TRUE = new AlwaysTruePredicate();

	/**
	 * 总是返回真（True）的断言；
	 * 
	 * @param <T>
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public static <T> Predicate<T> alwaysTrue() {
		return (Predicate<T>) ALWAYS_TRUE;
	}

	private static class AlwaysTruePredicate implements Predicate<Object> {

		@Override
		public boolean test(Object t) {
			return true;
		}

	}

}
